<div class="special-check main">
  <bid-tabs
    query-fn="equipmentInspection.equipInformation"
    query-bean="equipmentInspection.queryData"
    query-param="bidId"
    query-type="bid"></bid-tabs>
  <div class="query-info shadowbox">
    <div class="container-header">
      设备检测
    </div>
    <form class="base-info pa-form-content" name="queryForm">
      <div class="pa-form-control pa-form-control-inline">
        <label>设备名称：</label>
        <input type="text"
          ng-model="equipmentInspection.queryData.deviceName">
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label>内部编号：</label>
        <input type="text"
          ng-model="equipmentInspection.queryData.innerNo">
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label>设备等级：</label>
        <select id="type" name="type"
          ng-model="equipmentInspection.queryData.deviceLevel">
          <option value=""></option>
          <option value="1">一般设备</option>
          <option value="2">主要设备</option>
          <option value="3">关键设备</option>
          <option value="4">特种设备</option>
        </select>
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label>检测时间：</label>
        <input type="text" ng-datepicker name="startTime" required
          ng-model="equipmentInspection.queryData.startTime">
        到
        <input type="text" ng-datepicker name="endTime" required
          ng-model="equipmentInspection.queryData.endTime">
      </div>
    </form>
    <div class="btn-outer-right">
      <a class="pa-btn"
        ng-click="equipmentInspection.searchInformation(queryForm)">
        <i class="fa fa-search"></i>
        <span class="ml5">查询</span>
      </a>
      <a class="pa-btn reset-btn"
        ng-click="equipmentInspection.reset()">
        <i class="fa fa-repeat"></i>
        <span class="ml5">重置</span>
      </a>
    </div>
  </div>
  <!-- <div class="registration-code">
    <a class="pa-btn"
      ng-click="equipmentInspection.newTestCode()">
      新增检测记录
    </a>
  </div> -->
  <div class="pa-table-container shadowbox">
    <form class="base-info">
      <table class="pa-table">
        <thead>
          <tr>
            <th>所属标段</th>
            <th>设备等级</th>
            <th>设备名称</th>
            <th>内部编号</th>
            <th class="time-sequence">
              <div>检测时间</div>
              <div class="time-sequence-btn">
                <div class="time-sequence-box"
                  ng-click="equipmentInspection.up('check_time','0')">
                  <i class="fa fa-caret-up"></i>
                </div>
                <div class="time-sequence-box"
                  ng-click="equipmentInspection.up('check_time','1')">
                  <i class="fa fa-caret-down"></i>
                </div>
              </div>
            </th>
            <th class="time-sequence">
              <div>下次检测时间</div>
              <div class="time-sequence-btn">
                <div class="time-sequence-box"
                  ng-click="equipmentInspection.up('next_checktime','0')">
                  <i class="fa fa-caret-up"></i>
                </div>
                <div class="time-sequence-box"
                  ng-click="equipmentInspection.up('next_checktime','1')">
                  <i class="fa fa-caret-down"></i>
                </div>
              </div>
            </th>
            <th>检测结果</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr
            ng-repeat="item in equipmentInspection.equipmentInspectionItemList">
            <td>{{item.deviceInfoBean.tender}}</td>
            <td>
              {{item.deviceInfoBean.deviceLevel== '1' ? '一般设备' :
             item.deviceInfoBean.deviceLevel == '2' ? '主要设备' :
             item.deviceInfoBean.deviceLevel == '3' ? '关键设备' :
             item.deviceInfoBean.deviceLevel == '4' ? '特种设备' : ''}}
            </td>
            <td>{{item.deviceInfoBean.deviceName}}</td>
            <td>{{item.deviceInfoBean.innerNo}}</td>
            <td>{{item.checkTime}}</td>
            <td>{{item.nextChecktime}}</td>
            <td>
              {{item.checkResult == '1' ? '符合要求' :
                  item.checkResult == '2' ? '不符合要求' : ''}}
            </td>
            <td>
              <div class="edit-item fl del"
                authorization-btn="api/devicecheckrecord/selectCheckRecordInfo"
                ng-click="equipmentInspection.queryInformation(item.id)">
                <i class="fa fa-search color"></i>
                <span>查看</span>
              </div>
              <div class="edit-item fl del"
                authorization-btn="api/devicecheckrecord/selectCheckRecordInfo"
                ng-click="equipmentInspection.editInformation(item.id)">
                <i class="fa fa-pencil color"></i>
                <span>编辑</span>
              </div>
              <div class="edit-item fl del"
                authorization-btn="api/devicecheckrecord/deleteCheckRecord"
                ng-click="equipmentInspection.deleteInformation(item.id)">
                <i class="fa fa-trash color"></i>
                <span>删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </form>
    <div class="total-num">
      共计<span class="total-num-colorful">
      {{equipmentInspection.paginationData.total}}</span>条
    </div>
    <!-- 分页 -->
    <div class="pagination-outer">
      <uib-pagination
        total-items="equipmentInspection.paginationData.total"
        ng-model="equipmentInspection.paginationData.pageNum"
        items-per-page="equipmentInspection.paginationData.pageSize"
        ng-change="pageChange()"
        class="pagination-sm"
        boundary-link-numbers="true"
        max-size="5"
        next-text="下一页"
        previous-text="上一页"></uib-pagination>
    </div>
  </div>
</div>

<!-- 查看检测记录 -->
<script type="text/ng-template" id="queryEquipmentInspection">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>查看检测记录</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <div style="height:188px;">
        <div class="row-item">
          <div class="fixed-left-label">所属标段：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.tender}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">设备等级：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.deviceLevel == '1' ? '一般设备' :
               vm.editInfo.deviceInfoBean.deviceLevel == '2' ? '主要设备' :
               vm.editInfo.deviceInfoBean.deviceLevel == '3' ? '关键设备' :
               vm.editInfo.deviceInfoBean.deviceLevel == '4' ? '特种设备' : ''}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">设备名称：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.deviceName}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">内部编号：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.innerNo}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">检测时间：</div>
          <div class="right-value">
             {{vm.editInfo.checkTime}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">下次检测时间：</div>
          <div class="right-value">
            {{vm.editInfo.nextChecktime}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">检测结果：</div>
          <div class="right-value">
            {{vm.editInfo.checkResult == '1' ? '符合要求' :
            vm.editInfo.checkResult == '2' ? '不符合要求' : ''}}
          </div>
        </div>
      </div>
      <div class="file-list-outer" style="padding-left: 71px;">
        <div class="file-item"
          ng-repeat="item in vm.editInfo.fileBeans"
          style="font-size: 14px;">
          <span class="upload-file-name" style="display: inline-block;width: 70%;">{{item.fileName}}</span>
          <a class="pa-btn"
            ng-click="vm.preview(item, archiveDetail)">
            预览
          </a>
          <a class="pa-btn file-del-btn" target="_blank"
            ng-href="{{vm.getDownloadSrc(item)}}">
              下载
          </a>
        </div>
      </div>
      <!-- <div style="float: left;width: 150px;"
        ng-repeat = "item in vm.editInfo.fileBeans">
        <div class="avatar-attachment-upload-outer"
          >
          <img class="avatar-img" style="width: 100px;height: 150px"
            ng-src="{{vm.getAvatarSrc(item)}}"/>
          <a class="pa-btn file-del-btn" target="_blank"
            ng-href="{{vm.getDownloadSrc(item)}}">
              下载
          </a>
        </div>
      </div> -->
    </div>
  </div>
</script>

<!-- 新增检测记录 -->
<script type="text/ng-template" id="equipmentInspection">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>新增检测记录</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="addForm" novalidate>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>牌照：</div>
          <div class="right-value">
            <input type="text" name="license" required
              ng-model="addTextCode.addItem.deviceInfoBean.license"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.license.$dirty) && addForm.license.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="checkTime" required
              ng-model="addTextCode.addItem.checkTime"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.checkTime.$dirty) && addForm.checkTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>下次检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="nextChecktime" required
              ng-model="addTextCode.addItem.nextChecktime"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.nextChecktime.$dirty) && addForm.nextChecktime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测结果：</div>
          <div class="right-value">
            <div class="line test-results">
              <input class="test-form-control" name="result" required
                type="radio" value="1"
                ng-model="addTextCode.addItem.checkResult"/>符合要求
            </div>
            <div class="line test-results">
              <input class="test-form-control" name="result" required
                type="radio" value="2"
                ng-model="addTextCode.addItem.checkResult"/>不符合要求
            </div>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.result.$dirty) && addForm.result.$error.required">
            必填
          </span>
        </div>
        <div>
          <common-attachment-upload
            component-id="cp2"
            file-type="image"
            pick-btn-id="avatar_attachment_picker"
            upload-url="{{fileUploadUrl.device}}"
            file-list="addTextCode.attachments">
          </avatar-attachment-upload>
        </div>
      </form>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="addTextCode.submit(addForm)">
        <i class="fa fa-save"></i>
        <span class="ml5">确定</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>

<!--编辑检测信息-->
<script type="text/ng-template" id="editequipment">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>编辑检测信息</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="editForm" novalidate>
        <div desc="autofocus-input">
          <input type="text" autofocus="true"  style="opacity: 0;width: 0; height: 0;" />
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="checkTime" required
              ng-model="editInfo.checkTime"/>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.checkTime.$dirty) && editForm.checkTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>下次检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="nextChecktime" required
              ng-model="editInfo.nextChecktime"/>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.nextChecktime.$dirty) && editForm.nextChecktime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测结果：</div>
          <div class="right-value">
            <div class="line test-results">
              <input class="test-form-control" type="radio" value="1"
                name="checkResult" required
                ng-model="editInfo.checkResult"/>符合要求
            </div>
            <div class="line test-results">
              <input class="test-form-control" type="radio" value="2"
                name="checkResult" required
                ng-model="editInfo.checkResult"/>不符合要求
            </div>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.checkResult.$dirty) && editForm.checkResult.$error.required">
            必填
          </span>
        </div>
        <div>
          <common-attachment-upload
            component-id="cp2"
            file-type="file"
            pick-btn-id="edit_inspection_upload_btn"
            upload-url="{{fileUploadUrl.device}}"
            file-list="editInfo.fileBeans"></common-attachment-upload>
        </div>
        <!-- <div>
          <common-attachment-upload
            component-id="edit_inspection"
            file-type="image"
            pick-btn-id="edit_inspection_upload_btn"
            upload-url="{{fileUploadUrl.deviceCheckRecord}}"
            file-list="editInfo.fileBeans">
          </avatar-attachment-upload>
        </div> -->
      </form>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="this.submit(editForm)">
        <i class="fa fa-save"></i>
        <span class="ml5">确定</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>